﻿using Godot;


public class PlayerStateDash(Player player, StateMachine stateMachine, AnimatedSprite3D animation) : State (player, stateMachine, animation)
{
	private float direction = 0;
	private float dashTime = 0;
	
	public override void Enter()
	{
		base.Enter();
		dashTime = player.dashTime;
		direction = animation.FlipH ? -1 : 1;
		animation.Play(GameConstants.INPUT_DASH);
	}


	public override void Process(double delta)
	{
		base.Process(delta);
		if (duration >= dashTime)
		{
			stateMachine.SwitchState(player.groundState);
		}
	}

	public override void PhysicsProcess(double delta)
	{
		base.PhysicsProcess(delta);
		
		player.AddDash(direction);
	}
}